package com.tdd;

import java.util.concurrent.ConcurrentHashMap;

public class OperationFactory {
	ConcurrentHashMap<String, Operation> operators = new ConcurrentHashMap<String, Operation>();

	public Operation findOperationNamed(String operatorName) {
		Operation op = null;

		if ("-".equals(operatorName))
			op = new Minus();
		else if ("!".equals(operatorName))
			op = new Factorial();
		else if ("+".equals(operatorName))
			op = new Plus();
		else
			throw new RuntimeException(String.format("%s - unknown operator",
					operatorName));
		return op;
	}
}
